package com.suse.lhw.hms.authorizaiontserver.domin;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @ProjectName: health_manage_system
 * @Package: com.suse.lhw.security.domin
 * @ClassName: SecurityUser
 * @Description: java类作用描述
 * @Author: 李鸿炜
 * @CreateDate: 2021/2/19 10:24
 * @UpdateUser: 更新者
 * @UpdateDate: 2021/2/19 10:24
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
@Data
public class SecurityUser implements UserDetails {
    private String userId;

    private String nickname;

    private String password;

    /**
     * 判断用户的状态，0普通 1封禁
     */
    private Integer status;

    /**
     * 图片
     */
    private String img;

    private String spare1;

    private String spare2;

    private String spare3;

    private ArrayList<GrantedAuthority> grantedAuthorities;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.grantedAuthorities;
    }

    @Override
    public String getPassword() {
        return this.password;
    }

    @Override
    public String getUsername() {
        return this.userId;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
